import * as types from '../actions/types'

const default_state = {
    stream: [],
    status: 'stop',
    started: false
}

const recording = (state=default_state, action) => {
    switch (action.type) {
        case types.START_RECORDING:
            return {
                ...state,
                status: 'recording',
                started: true
            }
        case types.STOP_RECORDING:
            return {
                ...state,
                status: 'stop',
                stream: []
            }
        case types.UPDATE_STREAMING:
            return {
                ...state,
                status: 'recording',
                stream: action.stream
            }
        default:
            return state    
    }
}

export default recording